home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-05-11 | 1.5 KB | 77 lines | [TEXT/MPS ] |
- (*
- breakSPort trueOrFalse -- Send or clear a break on the serial port.
-
- To compile and link this file using Macintosh Programmer's Workshop,
-
- pascal -w breakSPort.p
- link -m ENTRYPOINT -o HyperCommands -rt XCMD=7030 -sn Main=breakSPort ∂
- breakSPort.p.o "{MPW}"Libraries:interface.o
-
- © Copyright 1987, 88 by Apple Computer, Inc.
-
- Initial coding 9/87 by Harry R. Chesley.
- *)
-
- {$R-}
-
- {$S breakSPort } { Segment name must be the same as the command name. }
-
- unit DummyUnit;
-
- interface
-
- uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- implementation
-
- type
-
- Str31 = String[31];
-
- procedure breakSPort(paramPtr: XCmdPtr); forward;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- begin
- breakSPort(paramPtr);
- end;
-
- procedure breakSPort(paramPtr: XCmdPtr);
-
- var onOff: Str255;
- doBreak: boolean;
-
- {$I XCmdGlue.inc}
-
- procedure Fail(errMsg: Str255); { set theResult and quit }
- begin
- paramPtr^.returnValue := PasToZero(errMsg);
- exit(breakSPort);
- end;
-
- {$I SPortUtil.inc}
-
- begin
- if paramPtr^.paramCount <> 1 then Fail('parameter count is not 1');
-
- SetUpSPortGlobals;
- EnsureOpenPort;
-
- GetStrParm(1,onOff); { First parameter is setting. }
- doBreak := false;
- if StringEqual(onOff,'true') or StringEqual(onOff,'on') then doBreak := true;
-
- if doBreak then
- begin
- if SerSetBrk(ThisSPort.portOutDev) <> noErr then Fail('SerSetBrk failed');
- end
- else
- begin
- if SerClrBrk(ThisSPort.portOutDev) <> noErr then Fail('SerClrBrk failed');
- end;
- end;
-
- end.
-